package cn.labbook.bluetooth.common;

import cn.labbook.bluetooth.entity.AdminRes;
import cn.labbook.bluetooth.entity.Resource;
import cn.labbook.bluetooth.service.IAdminResService;
import cn.labbook.bluetooth.service.IResourceService;
import cn.labbook.bluetooth.shiro.TokenUser;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;


/**
 * Created by Administrator on 2018/10/26.
 * Description :  Token管理器
 */
@Component
public class TokenManager {

    @Autowired
    IAdminResService adminResService;
    @Autowired
    IResourceService resourceService;
    /**
     * 获取当前用户的 token
     *
     * @return token
     */
    public static TokenUser getToken() {
        TokenUser token = (TokenUser) SecurityUtils.getSubject().getPrincipal();
        return token;
    }

    /**
     * 获取当前用户的 session
     *
     * @return session
     */
    public static Session getSession() {
        return SecurityUtils.getSubject().getSession();
    }
}
